<?php

use think\migration\Migrator;
use think\migration\db\Column;

class BasicPollutantStandards extends Migrator
{
    public function up()
    {
        $table = $this->table('basic_pollutant_standards');
        $table
            // step1:时间
            ->addColumn('publish_time', 'datetime', ['comment' => '发布时间',])

            // step2：数据
            ->addColumn('pollutant_name', 'string', ['comment' => '污染物的名称'])
            ->addColumn('standard_value', 'string', ['comment' => '污染物的行业标准值'])
            ->addColumn('industry_id', 'integer', ['limit' => 10, 'comment' => '行业ID'])
            ->addColumn('region_id', 'integer', ['limit' => 11, 'default' => 53, 'comment' => '区域ID'])
            ->addColumn('delete_time', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '软删除'])

            // 注释
            ->setComment('基本数据 - 污染物标准值')
            // 引擎
            ->setEngine('InnoDB')
            ->save();
    }

    public function down()
    {
        $this->table('basic_pollutant_standards')->drop();
    }
}
